from django.urls import path, re_path
from rbac.views import role
from rbac.views import user
from rbac.views import menu

urlpatterns = [
    path('role/list/', role.role_list, name='role_list'),  # rbac:role_list 名称空间+ 别名
    path('role/add/', role.role_add, name='role_add'),
    re_path(r'^role/edit/(\d+)/$', role.role_edit, name='role_edit'),
    re_path(r'^role/del/(\d+)/$', role.role_del, name='role_del'),

    path('user/list/', user.user_list, name='user_list'),  # rbac:user_list 名称空间+ 别名
    path('user/add/', user.user_add, name='user_add'),
    re_path(r'^user/edit/(\d+)/$', user.user_edit, name='user_edit'),
    re_path(r'^user/del/(\d+)/$', user.user_del, name='user_del'),
    re_path(r'^user/setpwd/(\d+)/$', user.user_set_pwd, name='user_set_pwd'),

    path('menu/list/', menu.menu_list, name='menu_list'),
    path('menu/add/', menu.menu_add, name='menu_add'),
    re_path(r'^menu/edit/(\d+)/$', menu.menu_edit, name='menu_edit'),
    re_path(r'^menu/del/(\d+)/$', menu.menu_del, name='menu_del'),
    # reverse('rbac:menu_edit',args=1) 如果有?P<name> 则是应用kwargs={pk:1}

    re_path(r'^second/menu/add/(\d+)/$', menu.second_menu_add, name='second_menu_add'),
    re_path(r'^second/menu/del/(\d+)/$', menu.second_menu_del, name='second_menu_del'),
    re_path(r'^second/menu/edit/(\d+)/$', menu.second_menu_edit, name='second_menu_edit'),

    re_path(r'^permission/menu/add/(\d+)/$', menu.permission_menu_add, name='permission_menu_add'),
    re_path(r'^permission/menu/del/(\d+)/$', menu.permission_menu_del, name='permission_menu_del'),

    path('multi/permissions/',menu.multi_permissions,name='multi_permissions'),
    re_path(r'^multi/permissions/del/(\d+)/$',menu.multi_permissions_del,name='multi_permissions_del'),

    path('distribute_permissions/',menu.distribute_permissions,name='distribute_permissions')

]
